<template>
	<view class="content">
		<view class="close-title">
			<!-- 基本用法 -->
			<!-- <uni-steps :options="numList" :active="setpCurrent"></uni-steps> -->
			
		</view>
		<!-- 发货 -->
		<view class="deliver">
			
			<view class="deliver-title" v-show="setpCurrent==1">待发货</view>
			<view class="deliver-title" v-show="setpCurrent==2">已发货</view>
			<view class="deliver-title" v-show="setpCurrent==3 | 4">交易成功</view>
			<view class="deliver-title" v-show="setpCurrent==0">待付款
				<view class="deliver-title-right">
					有效付款时间： 13:20:21
				</view>
			</view>
			
			<view class="deliver-break"></view>
			<view class="deliver-content">暂时无法获取到物流信息</view>
			<view class="deliver-content" v-show="setpCurrent==2 | 3">
				<view class="deliver-content1">中通快递 ZT081829382938</view>
				<view><uni-icons type="arrowright" size="10"></uni-icons></view>
			</view>
		</view>
		<view class="close-content">
			<view class="close-content-img">
				<image src="../../../static/mall/mall13.png" mode=""></image>
			</view>
			<view class="close-content-name">
				<view class="close-content-name1">
					Microsoft Xbox one S 专业游戏玩家 1TB</view>
					<view class="close-content-name2">电子数码|游戏机</view>
					<view class="close-content-name3">￥2839.92</view>
			</view>
		</view>
		<!-- 收货地址 -->
		<view class="close-dizhi">
			<view class="close-dizhi1">
				收货地址： 无辣不欢 16888293743
			</view>
			<view class="close-dizhi2">
				山东省济南市先行区王大佬庄183号无名氏街道蛋蛋花园一号楼2单元1128
			</view>
		</view>
		<!-- 操作日志 -->
		<view class="close-log">
			<view class="log-title">
				<view class="log-title1">操作日志</view>
				<view class="log-title2">联系卖家</view>
			</view>
			<view class="log-content">
				<view class="log-content1">订单编号： YW20210101120817569808</view>
				<view class="log-content2">对方昵称： 王小子</view>
				<view class="log-content3">拍下时间： 2020。12.12 15:28:12</view>
				<view class="log-content4">付款时间： 2020.12.12 15:28:12</view>
			</view>
		</view>
	<!-- 底部按钮你 -->
	<view class="close--bottom-btn" v-show="setpCurrent==1">
		<view class="close--bottom-btn1">取消订单</view>
		<view class="close--bottom-btn2" @click="goShipments">确认发货</view>
	</view>
	<view class="close--bottom-ping">
		<view class="close--bottom-ping1" v-show="setpCurrent==3" @click="pingJia">我要评价</view>
		<view class="close--bottom-ping1" v-show="setpCurrent==4">我的评价</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				waresId:'4b7ed5435b8d4de2b656e1be47487e26',//商品id
				orderId:'',// 订单ID
				 evaluateContent:'',//评价内容
				waresPrice:'',// 寄售商品价格
				walletPrice:'100',// 余额支付金额（未用传0
				actualPrice:'100',//实付金额
				address:'',// 收货地址
				ucId:'',// 优惠券ID
				discount:'',//优惠券抵扣金额
				kdName:'',//快递公司名称
				kdCode:'',//快递公司code
				kdNumber:'',//快递公司单号
				//步骤条的步数1-3
				    numList: [{
				     title: '已拍下'
				    }, {
				     title: '已付款'
				    }, {
				     title: '已发货'
				    },
					{
					 title: '交易成功'
					},
					{
					 title: '已评价'
					}],
				    //步骤条的步数进度
				    setpCurrent: '',
			};
		},
		onLoad(parameter) {
			console.log(parameter.pages)
			this.setpCurrent = parameter.pages
			this.zhiFu()
			this.goExpress()
			this.maiShouhuo()
			this.maiDingdan()
			this.maiDingdan2()
		},
		methods:{
			//卖家订单评价
			maiDingdan2() {
				var that = this
				that.$http.req.ajax({
				     path: ':8090/web/idleOrders/idleOrderSellEvaluate',
					 header: {
					       'token': uni.getStorageSync('token')
					      },
				     data: {
					 orderId:'555',//订单id
					 waresId:that.waresId,// 寄售商品ID
					 evaluateState:'1',// 1好评2差评
					 evaluateContent:'评价内容评价内容评价内容',// 评价内容
				     },
				     afterAjax: (res) => {
						 		console.log(res,'卖家订单评价')
						 		if (res.code !== 200) {
						 			uni.showToast({
						 				title: '获取卖家订单评价失败',
						 				icon: 'none'
						 			})
						 		}
						 		if (res.code == 200) {
						 			console.log('拿到卖家订单评价')
						 		}
				     }
				    })
			},
			//买家订单评价
			maiDingdan() {
				var that = this
				that.$http.req.ajax({
				     path: ':8090/web/idleOrders/idleOrderBuyEvaluate',
					 header: {
					       'token': uni.getStorageSync('token')
					      },
				     data: {
					 orderId:'555',//订单id
					 waresId:that.waresId,// 寄售商品ID
					 evaluateState:'1',// 1好评2差评
					 evaluateContent:'评价内容评价内容评价内容',// 评价内容
				     },
				     afterAjax: (res) => {
						 		console.log(res,'买家订单评价')
						 		if (res.code !== 200) {
						 			uni.showToast({
						 				title: '获取买家订单评价失败',
						 				icon: 'none'
						 			})
						 		}
						 		if (res.code == 200) {
						 			console.log('拿到买家订单评价')
						 		}
				     }
				    })
			},
			//买家确认收货
			maiShouhuo() {
				var that = this
				that.$http.req.ajax({
				     path: ':8090/web/idleOrderConfirmProduct',
					 header: {
					       'token': uni.getStorageSync('token')
					      },
				     data: {
					orderId:that.waresId,//订单id
					 
				     },
				     afterAjax: (res) => {
						 		console.log(res,'买家确认收货')
						 		if (res.code !== 200) {
						 			uni.showToast({
						 				title: '获取买家确认收货失败',
						 				icon: 'none'
						 			})
						 		}
						 		if (res.code == 200) {
						 			console.log('拿到买家确认收货')
						 		}
				     }
				    })
			},
			//获取快递列表
			goExpress() {
				var that = this
				that.$http.req.ajax({
				     path: ':8090/web/kuaidi/getKuaidiList',
					 header: {
					       'token': uni.getStorageSync('token')
					      },
				     data: {
					 pageNum:'10',//页数
					 pageSize:'10',//每页显示条数
				     },
				     afterAjax: (res) => {
						 		console.log(res,'获取快递列表')
						 		if (res.code !== 200) {
						 			uni.showToast({
						 				title: '获取快递列表失败',
						 				icon: 'none'
						 			})
						 		}
						 		if (res.code == 200) {
						 			console.log(res.data,'拿到获取快递列表')
									setTimeout(
									function() {
										that.kdName = res.data[0].kuaidiName
										that.kdCode = res.data[0].kuaidiCode
										console.log(that.kdName, that.kdCode)
									},200
									)
									
									
						 		}
				     }
				    })
			},
			//创建待支付订单
			zhiFu() {
				var that = this
				that.$http.req.ajax({
				     path: ':8090/web/idleOrders/idleOrderSave',
					 header: {
					       'token': uni.getStorageSync('token')
					      },
				     data: {
					 waresId:that.waresId,//订单id
					 walletPrice:that.walletPrice,// 余额支付金额（未用传0
					 actualPrice:that.actualPrice,//实付金额
					 address:that.address,// 收货地址
					 ucId:that.ucId,// 优惠券ID
					 discount:that.discount,//优惠券抵扣金额
					 
				     },
				     afterAjax: (res) => {
						 		console.log(res,'订单评价')
						 		if (res.code !== 200) {
						 			uni.showToast({
						 				title: '获取创建待支付失败',
						 				icon: 'none'
						 			})
						 		}
						 		if (res.code == 200) {
						 			console.log('拿到创建待支付')
						 		}
				     }
				    })
			},
			//寄售订单评价
			pingJia() {
				var that = this
				that.$http.req.ajax({
				     path: ':8090/web/idleOrders/idleOrderEvaluate',
					 header: {
					       'token': uni.getStorageSync('token')
					      },
				     data: {
					 orderId:that.orderId,//订单id
				     },
				     afterAjax: (res) => {
						 		console.log(res,'订单评价')
						 		if (res.code !== 200) {
						 			uni.showToast({
						 				title: '获取订单评价失败',
						 				icon: 'none'
						 			})
						 		}
						 		if (res.code == 200) {
						 			console.log('拿到订单评价')
						 		}
				     }
				    })
			},
			//寄售商品发货
			goShipments() {
				var that = this
				that.$http.req.ajax({
				     path: ':8090/web/idleOrders/idleOrderDeliver',
					 header: {
					       'token': uni.getStorageSync('token')
					      },
				     data: {
					 orderId:that.orderId,//订单id
					 kdName:that.kdName,//快递公司名称
					 kdCode:that.kdCode,//快递公司code
				     },
				     afterAjax: (res) => {
						 		console.log(res,'寄售商品发货')
						 		if (res.code !== 200) {
						 			uni.showToast({
						 				title: '获取寄售商品发货失败',
						 				icon: 'none'
						 			})
						 		}
						 		if (res.code == 200) {
						 			console.log('拿到寄售商品发货')
						 		}
						 	
				     }
				    })
			},
	
		}
	}
</script>

<style lang="scss">
.content {
	width: 100%;
	background-color: #f5f5f5;
	height: 100%;
	.close-title {
		font-size: 28rpx;
		font-weight: 600;
		padding-top: 36rpx;
		padding-bottom: 54rpx;
		padding-left: 25rpx;
		background: linear-gradient(#fcc122, #ffe246);
	}
	.close-content {
		border-radius: 14rpx;
		background-color: #FFFfff;
		margin: 25rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		.close-content-img {
			width: 206rpx;
			height: 206rpx;
			margin: 25rpx;
			image {
				max-width: 100%;
				max-height: 100%;
			}
		}
		.close-content-name {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			margin: 25rpx;
			
			.close-content-name1 {
				
				font-size: 25rpx;
				font-weight: 600;
			}
			.close-content-name2 {
				font-size: 21rpx;
				margin-top: 21rpx;
				color: #c2c2c2;
			}
			.close-content-name3 {
				font-size: 25rpx;
				color: #eb3e3e;
				font-weight: 600;
			}
		}
	}
	// 地址
	.close-dizhi {
		margin: 25rpx;
		border-radius: 18rpx;
		background-color: #FFFFFF;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		.close-dizhi1 {
			font-size: 28rpx;
			font-weight: 600;
			margin: 25rpx;
		}
		.close-dizhi2 {
			font-size: 21rpx;
			margin: 21rpx 25rpx 25rpx 25rpx;
		}	
	}
	// 日志
	.close-log {
		margin: 25rpx;
		background-color: #ffffff;
		border-radius: 18rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		.log-title {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			margin: 25rpx;
			.log-title1 {
				font-size: 28rpx;
				font-weight: 600;
			}
			.log-title2 {
				border-radius: 25rpx;
				font-size: 21rpx;
				border: 1rpx solid #cccccc;
				padding: 10rpx 18rpx;
			}
		}
		.log-content {
			margin: 25rpx;
			color: #b0b0b0;
			font-size: 21rpx;
			.log-content1, .log-content2, .log-content3, .log-content4 {
				margin: 5rpx 0;
			}
			
		}
	}
	// 待发货
	.deliver {
		// position: fixed;
		// top: 17%;
		// z-index: 999;
		margin: -25rpx 25rpx;
		margin-bottom: 50rpx;
		
		background-color: #ffffff;
		border-radius: 18rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-around;
		.deliver-title {
			font-size: 28rpx;
			font-weight: 600;
			margin: 27rpx 25rpx;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			.deliver-title-right {
				font-size: 21rpx;
				color: #2b9cef;
				margin: 0 25rpx;
			}
		}
		.deliver-break {
			margin: 25rpx;
			height: 1rpx;
			background-color: #EEEEEE;
		}
		.deliver-content {
			margin: 21rpx 25rpx;
			color-rendering: #21201d;
			font-size: 21rpx;
			font-weight: 300;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			.deliver-content1 {
				color: #2b9cef;
			}
		}
	}
	// 底部按钮
	.close--bottom-btn, .close--bottom-ping {
		background-color: #FFFFFF;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		.close--bottom-btn1, .close--bottom-btn2 {
			border-radius: 39rpx;
			width: 340rpx;
			height: 79rpx;
			margin: 12rpx 25rpx;
		}
		.close--bottom-btn1 {
			border: 1rpx solid #d94d46;
			color: #d94d46;
			text-align: center;
			line-height: 79rpx;
		}
		.close--bottom-btn2 {
			background-color: #ffe246;
			text-align: center;
			line-height: 79rpx;
			
		}
		.close--bottom-ping1 {
			background-color: #ffe246;
			border-radius: 39rpx;
			line-height: 79rpx;
			text-align: center;
			font-size: 25rpx;
			width: 100%;
			margin: 12rpx 25rpx;
		}
	}

}
</style>
